<?php

namespace Admin\Controller;

use Think\Controller;

class AdminCoreController extends Controller{
	
	public $userinfo;
	
	protected function _initialize(){

		define('UID', is_login());
		
		if(!UID ){
			
            $this->redirect('Admin/Public/login');
			
        }
		
		$_GET['p'] = $_GET['pageIndex'] + 1;
		
		if(session(C('AUTH_KEY')) > 0){
			
			$this->userinfo =session('userinfo');
			
			$this->assign('userInfo', $this->userinfo);
			
		}
		
	}
	
	public function tojson($arr, $count){
		
        $data = array();
		
        $data['rows'] = $arr;
		
        $data['results'] = intval($count);
		
        return json_encode($data);
		
    }
	
}